#! /usr/bin/python
#coding:utf-8
__author__ = 'guolt'

import wx


def openFile(evt):
    file_read=open(file_path.GetValue()).read()
    file_contents.SetValue(file_read)

def saveFile(evt):
    file_write=open(file_path.GetValue(),'w')
    file_write.write(file_contents.GetValue())
    file_write.close()


app=wx.App()
win=wx.Frame(None,title="wxpython note",size=(410,340))
openb=wx.Button(win,label="open",pos=(245,5),size=(80,25))
saveb=wx.Button(win,label="save",pos=(325,5),size=(80,25))
file_path=wx.TextCtrl(win,pos=(5,5),size=(240,25))
file_contents=wx.TextCtrl(win,pos=(5,35),size=(400,300),style=wx.TE_MULTILINE|wx.HSCROLL)

openb.Bind(wx.EVT_BUTTON,openFile)
saveb.Bind(wx.EVT_BUTTON,openFile)

win.Show()
app.MainLoop()
